<?php
declare (strict_types = 1);

namespace app\api\model;

use app\common\model\TimeModel;

class SupplyUser extends TimeModel
{
    /**
     * 通过openid获取用户信息,不存在创建
     * @MethodAuthor: 聂哥
     * @Date: 2023-03-11 01:03:40
     */
    public static function getUidByOpenid($openid)
    {
        $rows = self::where('openid',$openid)->find();
        if( empty($rows) ){
            $rows = self::create([
                'openid' => $openid
            ]);
        }
        return $rows->id;
    }
}